package com.weibo4j.api.req.status;

import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;

import com.weibo4j.api.WeiboRequest;
import com.weibo4j.api.annotation.Param;
import com.weibo4j.api.response.status.StatusAddResponse;
import com.weibo4j.api.util.RequestType;

public class TextStatusAddRequest extends WeiboRequest<StatusAddResponse>{
    
    private Long id;
    
    private String status;
    
    private String lat;
    
    private String longitude;
    
    private String annotations;

    public String getAnnotations() {
        return annotations;
    }

    public void setAnnotations(String annotations) {
        this.annotations = annotations;
    }

    public String getLat() {
        return lat;
    }

    public void setLat(String lat) {
        this.lat = lat;
    }

    public String getLongitude() {
        return longitude;
    }

    @Param("long")
    public void setLongitude(String longitude) {
        this.longitude = longitude;
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getStatus() {
        if (status != null) {
            try {
                return URLEncoder.encode(status, "utf-8");
            } catch (UnsupportedEncodingException e) {
            }
        }
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    @Override
    public RequestType requestType() {
        return RequestType.POST;
    }

    @Override
    public String baseUrl() {
        return "https://api.weibo.com/2/statuses/update.json";
    }

    @Override
    public Class<StatusAddResponse> responseType() {
        return StatusAddResponse.class;
    }

}
